import {ADD} from '../constant'
const init=[{id:'001',name:'gyl',age:'21'}]
export default function personReducer(prestate=init,action){
   const {type,data} =action
   switch (type) {
       case ADD:
           //返回的和prestate地址在一样将不变，redux是浅比较 要不一样
           //满足纯函数
           return[data,...prestate];
   
       default:
           return prestate;
   }
}